package com.lancoo.dictionary.nc;

import org.xutils.x;
import org.xutils.common.Callback.Cancelable;
import org.xutils.common.Callback.CommonCallback;
import org.xutils.http.RequestParams;

import com.lancoo.dictionary.DictionaryHelper;

public class NetworkConnection extends RequestParams {
	
	private Cancelable cancelable;

	public NetworkConnection(String knowledge,CommonCallback<String> callback) {
		super(DictionaryHelper.API_PATH);
		this.addBodyParameter("levelCode", "");
		this.addBodyParameter("knowledge", knowledge);
		cancelable=x.http().get(this, callback);
	}
	
	public void cancelConnection(){
		if (cancelable!=null&&!cancelable.isCancelled()) {
			cancelable.cancel();
		}
	}
	
}
